home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
NetNews Offline 2
/
NetNews Offline Volume 2.iso
/
news
/
comp
/
std
/
c
/
142
< prev
next >
Wrap
Internet Message Format
|
1996-08-06
|
2KB
Path: newshost.lanl.gov!tanmoy
From: tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya)
Newsgroups: comp.std.c
Subject: Re: atexit() and return from main()
Date: 18 Jan 1996 15:40:25 GMT
Organization: Los Alamos National Laboratory
Message-ID: <TANMOY.96Jan18084025@qcd.lanl.gov>
References: <4dhfja$j50@fg70.rz.uni-karlsruhe.de> <4diicg$i9e@lyra.csx.cam.ac.uk>
<821923074snz@genesis.demon.co.uk> <4dkvjk$6q5@lyra.csx.cam.ac.uk>
NNTP-Posting-Host: qcd.lanl.gov
Mime-Version: 1.0
Content-Type: text
In-reply-to: nmm1@cus.cam.ac.uk's message of 18 Jan 1996 08:15:48 GMT
--text follows this line--
In article <4dkvjk$6q5@lyra.csx.cam.ac.uk> nmm1@cus.cam.ac.uk (Nick
Maclaren) writes:
<snip>
But you are making a serious mistake in assuming that run-time systems
can be implemented to allow everything that the standard permits by
omission. They can't. In THIS case, they can usually preserve the
stack before calling the atexit() functions.
I think you are bringing up non-issues.
However, for the advanced paper, think about the following problems:
What is the effect of an atexit() function calling exit()? Does it
restart the atexit() queue, carry on as if the function had returned
or does it abandon the atexit() queue?
I chose to do the second, as by far the most user-friendly, but I
would NEVER write serious code that relied upon that action!
main() calls setjmp() and then calls exit(). An atexit() function
calls longjmp() and returns to main(). This repeats (or does it?)
This is ALSO permitted by omission, but a good run-time system will
trap it, issue an error message and stop without calling more atexit()
functions.
Neither of these is permitted in any sense that I understand!
7.10.4.3: If more than one call to the exit function is executed by
a program, the behaviour is undefined. No `permission by omission'
that I can see.
Cheers
Tanmoy
--
tanmoy@qcd.lanl.gov(128.165.23.46) DECNET: BETA::"tanmoy@lanl.gov"(1.218=1242)
Tanmoy Bhattacharya O:T-8(MS B285)LANL,NM87545 H:#9,3000,Trinity Drive,NM87544
Others see <gopher://yaleinfo.yale.edu:7700/00/Internet-People/internet-mail>,
<http://alpha.acast.nova.edu/cgi-bin/inmgq.pl>or<ftp://csd4.csd.uwm.edu/pub/
internetwork-mail-guide>. -- <http://nqcd.lanl.gov/people/tanmoy/tanmoy.html>
fax: 1 (505) 665 3003 voice: 1 (505) 665 4733 [ Home: 1 (505) 662 5596 ]